home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / languages / cleo.lzh / Cleo / examples / det.cl < prev    next >
Encoding:
Text File  |  1993-01-24  |  785 b   |  28 lines

  1. program exemple_sqrt;   { determinant }
  2.  
  3. var
  4.     a,b,c,d : real;
  5.     root1, root2    : real;
  6.  
  7. begin
  8.     writeln('Pour arreter, taper 0');
  9.     write ('Entrer les 3 coefs: ');
  10.     readln(a,b,c);
  11.     while a<>0 do
  12.         begin
  13.              d:= sqr(b)-4*a*c;
  14.              if d>0 then
  15.                 begin
  16.                     root1 := ((((-b)+sqrt(d))))/2*a;   { prb: SI (2*a) }
  17.                     root2 := ((-b)-sqrt(d))/2*a;
  18.                     writeln('Les Racines de ',a,'x^2+',b,'x+',c,' sont :',root1,' ',root2);
  19.                 end
  20.              else
  21.              if d=0 then
  22.                 writeln(' Racine unique:', -b/2*a)
  23.              else
  24.                 writeln('Pas de solution simple');
  25.              write('Prochains coefs:');
  26.              readln(a,b,c);
  27.         end;
  28. end.